home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / toasterpaint / bwbordervign.rexx < prev    next >
OS/2 REXX Batch file  |  1995-12-27  |  5KB  |  172 lines

  1. /* BWBorderVign.rexx V2.0 -- Colorize a clip.          */
  2. /* By Bob Caron © 1995 NewTek Inc.                     */
  3.  
  4. parse arg InClipName","OutClipName","StartField","EndField
  5.  
  6. Address "DigiPaint"
  7. options results
  8.  
  9. IFFBaseName=OutClipName
  10.  
  11. if ~show('l','rexxsupport.library') then do
  12.   if ~addlib('rexxsupport.library',0,-30,34) then do
  13.     exit
  14.   end
  15. end
  16.  
  17. screen=0
  18. if inclipname="" then screen=1
  19. if screen=1 then do
  20.    startfield=1
  21.    endfield=1
  22.    end
  23.  
  24. /* Reset Paint */
  25. 'Pmcl'
  26. 'Pot0' 0
  27. 'Pot1' 0
  28. 'Poth' $8000
  29. 'Potv' $8000
  30. 'Spoh' $8000
  31. 'Spov'
  32. /* End Of Reset*/
  33.  
  34. PageWide=752
  35. PageHigh=480
  36. x1=94
  37. y1=65
  38. x2=662
  39. y2=428
  40. dots=0
  41. XWin = 100
  42. YWin = 40
  43. Clear = d2c(12)
  44. nv = ''
  45. cr = '0a'x
  46. call getfontsize
  47.  
  48. wid = width*48
  49. hei = theight+height*10
  50.  
  51. if screen=0 then do
  52.    if ~open('Window','RAW:'XWin'/'YWin'/'wid'/'hei'/BWBorderVign Script V2.0 - CTRL-C to Abort/NOSIZE/SCREEN 'ps,'W') then do
  53.        exit
  54.    end
  55. end
  56.  
  57. do Frame = StartField to (StartField+(EndField-StartField)/2)
  58.   if screen=0 then  call OpenWindow(InclipName,OutClipName,frame,Endfield,Frame)
  59.   if screen=0 then 'Gnfd'          /* Get the next field to process          */
  60.   call filter(x1,y1,x2,y2)  /* If this is a flyer clip do other field */
  61.   if screen=0 then 'Apfc'          /* Apeend the field to clip               */
  62.   if screen=0 then 'Gnfd'          /* Get the next field to process          */
  63.   if screen=0 then call filter(x1,y1,x2,y2)  /* If this is a flyer clip do other field */
  64.   if screen=0 then 'Apfc'          /* Apeend the field to clip               */
  65.   if screen=1 then 'Shco'          /* Render To Buffer (if this is screen processing)*/
  66.   end
  67. if screen=0 then 'Iclp'            /* Add an flyer icon to this clip */
  68. exit
  69.  
  70. filter: PROCEDURE /* Do a filter */
  71. parse arg x1,y1,x2,y2
  72.   'Pmcl'                           /* Set to normal paint mode */
  73.    Call CutBrush(0,0,752,480)      /*  Cut brush along top */
  74. if screen=0 then  call OpenWindow(InclipName,OutClipName,frame,Endfield,Frame)
  75.   'Swap'
  76.    call MapBrush(x1, y1, x2, y2)
  77.   'Swap'
  78.    call CutBrush(x1, y1, x2, y2)
  79. if screen=0 then  call OpenWindow(InclipName,OutClipName,frame,Endfield,Frame)
  80.    call clearscreen
  81.    call MapBrush(0,0,752,480)
  82.   '8rgb' 255 255 255 /* White */
  83.   'Pmco'             /* colorize Mode */
  84.   'Mane'             /* Set Edge transparency to 0% */
  85.   'Whsc'             /* Fill Whole Screen */
  86. if screen=0 then  call OpenWindow(InclipName,OutClipName,frame,Endfield,Frame)
  87.   'Rubt'
  88.   'Drrf'
  89.   'Pend' x1 y1
  90.   'Penu' x2 y2
  91.   'Pmcl'
  92.  
  93. return
  94.  
  95. CutBrush: PROCEDURE  /* Cut out a brush with corners at (x1,y1) and (x2,y2) */
  96.   arg x1, y1, x2, y2
  97.   'Pmcl'
  98.   'Bdel'
  99.   'Dotb'        /* smallest brush size */
  100.   'Drre'        /* Rectangle mode  */
  101.   'Scis'        /* Scissors on, for cutting a brush  */
  102.   'Pend' x1 y1  /* Get in top Left corner  */
  103.   'Penu' x2 y2  /* lift pen to get brush!  */
  104. return 0
  105.  
  106. MapBrush: PROCEDURE  /* Size swap brush into rectangle with corners at (x1,y1) and (x2,y2) */
  107.   arg x1, y1, x2, y2 /* if there is no swap brush, whole screen is used! */
  108.   'Bcop'
  109.   'Flon'        /* Fill On */
  110.   'Maxc'        /* Set center transparency off */
  111.   'Maxe'        /* Set edge transparency off */
  112.   'Aaon'        /* Anti-alias on */
  113.   'Txma'        /* Texture mapping on, fill on, draw rectangles  */
  114.   'Drre'        /* Draw Rectangles */
  115.   'Pend' x1 y1  /* Get in top Left corner  */
  116.   'Penu' x2 y2  /* lift pen  */
  117.   'Flof'        /* fill off  */
  118.   'Pmcl'        /* Normal draw Mode */
  119.   return 0
  120.  
  121. clearscreen:
  122.   '8rgb' 0 0 0
  123.   'Clrs'
  124.   'Cbx1'
  125.   return
  126.  
  127.  
  128. OpenWindow:
  129. parse arg InclipName,OutClipName,currentframe,EndFrame,Frame
  130.   pdots="...."
  131.   dots=dots+1
  132.   if dots>4 then dots=1
  133.   call writech('Window',Clear||nv||cr)
  134.   call writech('Window','Current Source Clip ['InClipName']'cr)
  135.   call writech('Window','  Current Dest Clip ['OutClipName']'cr)
  136.   call writech('Window',''cr)
  137.   call writech('Window','Current Frame: 'Frame/2''cr)
  138.   call writech('Window','    End Frame:'EndFrame/2''cr)
  139.   call writech('Window',''cr)
  140.   call writech('Window','Processing'right(pdots,dots)||cr)
  141.  
  142. return
  143.  
  144.  
  145. getfontsize:
  146.  
  147. if open('font','env:sys/font.prefs','R') then do
  148.    font = readch('font',word(statef('env:sys/font.prefs'),2))
  149.    call close('font')
  150.    font = substr(font,index(font,'FONT')+4)
  151.    font = substr(font,index(font,'FONT')+4)
  152.    height = c2d(substr(font,29,2))
  153.    tfont = substr(font,index(font,'FONT')+4)
  154.    theight = c2d(substr(tfont,29,2))
  155.    font = substr(font,33)
  156.    font = left(font,index(font,d2c(0))-1-5)
  157.    if open('font','FONTS:'font'/'height,'R') then do
  158.       pad=readch('font',116)
  159.       width = c2d(right(pad,2))
  160.       call close('font')
  161.   end
  162.   else if height=9 then width = 10
  163.                    else width = 8
  164. end
  165.   else do
  166.   theight = 8
  167.   height = 8
  168.   width = 8
  169. end
  170.  
  171. return
  172.